package ntd.block.server.bo;

import cn.hutool.core.bean.BeanUtil;
import lj.netty.bean.LJNettyBo;
import lombok.Data;

/**
 * 交互应用 - 消息参数
 */
@Data
public class ComServerMsgBo {

    /** 消息内容 */
    private String msg;

    /**
     * tcp - 消息通道标识
     * http - 相对路径标识
     */
    private String key;

    /** 消息来源ip */
    private String ip;

    public static ComServerMsgBo transform(LJNettyBo ljNettyBo) {
        ComServerMsgBo comServerMsgBo = new ComServerMsgBo();
        comServerMsgBo.setMsg(new String(ljNettyBo.getBytes()));
        comServerMsgBo.setKey(ljNettyBo.getNettyCode());
        comServerMsgBo.setIp(ljNettyBo.getIp());
        return comServerMsgBo;
    }
}
